// index.js
Page({
  data: {
    swiperIndex:0,
    swiper_img:[
      "../../images/index/swiper1.jpg",
      "../../images/index/swiper4.jpg",
      "../../images/index/swiper3.jpg"
    ],
  },
  swiperChange(e) {
    const that = this;
    that.setData({
      swiperIndex: e.detail.current,
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var volunteerId_get = wx.getStorageSync('volunteerId');//wx.getStorageSync(key)，获取本地缓存
    console.log('volunteerId_get:',volunteerId_get)
    if(volunteerId_get){
      console.log("为真")
    }else{
      console.log('为假')
      wx.navigateTo({
        url: '/pages/login/login',
        success: (result) => {
          console.log('跳转到登录界面：',result)
        },
        fail: (res) => {
          console.log('跳转到登录界面失败：',res)
        },
      })
    }
  }
})
